#!/sbin/sh
# Script for checking prerequisites for OpenSIPS-mysql

BASE="OpenSIPS-base"
LIBMYSQL="libmysqlclient.so.15"
TMPLIST="/tmp/.opensipsmysql"

pkginfo | grep -i $BASE > /dev/null

if [ $? -eq 1 ]
then
	echo "OpenSIPS-mysql depends on package OpenSIPS-base which is not installed";
	exit 1;
fi

find / -name $LIBMYSQL > $TMPLIST 2>&1
lines=`wc -l $TMPLIST`

if [ $lines = "0" ]
then
	echo "OpenSIPS-mysql depends on MySQL Client Libraries, which cannot be found on system";
	exit 1;
else
	exit 0;
fi
